//
//  HPLTCellView.m
//  SanYiTeaching
//
//  Created by 李文强 on 2019/4/3.
//  Copyright © 2019 李文强. All rights reserved.
//

#import "HPLTCellView.h"

@implementation HPLTCellView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
- (instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self initSubView];
    }
    return self;
}
- (void)initSubView{
    self.backgroundColor = [UIColor colorWithRed:248/255.0 green:248/255.0 blue:248/255.0 alpha:1.0];
    self.layer.cornerRadius = 5;
    [self addSubview:self.titleLabel];
    [self addSubview:self.teacherLabel];
    [self addSubview:self.timeLabel];
    [self addSubview:self.otherLabel];
    
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@12);
        make.right.equalTo(@0).offset(-12);
        make.top.equalTo(@0).offset(10*fh);
        make.height.equalTo(@14);
    }];
    [_teacherLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@12);
        make.right.equalTo(@0).offset(-12);
        make.top.equalTo(self.titleLabel.mas_bottom).offset(10*fh);
        make.height.equalTo(@14);
    }];
    [_timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@12);
        make.right.equalTo(@0).offset(-12);
        make.top.equalTo(self.teacherLabel.mas_bottom).offset(10*fh);
        make.height.equalTo(@14);
    }];
    [_otherLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@12);
        make.right.equalTo(@0).offset(-12);
        make.top.equalTo(self.timeLabel.mas_bottom).offset(10*fh);
        make.height.equalTo(@14);
    }];
}
- (UILabel *)titleLabel{
    if (!_titleLabel) {
        UILabel *label = [[UILabel alloc]init];
        label.text = @"《新概念》二册 Lesson 67";
        NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:label.text attributes:@{NSFontAttributeName: [UIFont fontWithName:@"PingFang-SC-Regular" size: 14],NSForegroundColorAttributeName: TITLECOLOR}];
        label.attributedText = string;
        _titleLabel = label;
    }
    return _titleLabel;
}
- (UILabel *)teacherLabel{
    if (!_teacherLabel) {
        UILabel *label = [[UILabel alloc]init];
        label.text = @"陈亮 17暑初一 六";
        NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:label.text attributes:@{NSFontAttributeName: [UIFont fontWithName:@"PingFang-SC-Regular" size: 12],NSForegroundColorAttributeName:TITLECOLOR}];
        
        label.attributedText = string;
        _teacherLabel = label;
    }
    return _teacherLabel;
}
- (UILabel *)timeLabel{
    if (!_timeLabel) {
        UILabel *label = [[UILabel alloc]init];
        label.text = @"2019-03-06 10:28:20";
        NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:label.text attributes:@{NSFontAttributeName: [UIFont fontWithName:@"PingFang-SC-Regular" size: 12],NSForegroundColorAttributeName: [UIColor colorWithRed:153/255.0 green:153/255.0 blue:153/255.0 alpha:1.0]}];
        label.attributedText = string;
        _timeLabel = label;
    }
    return _timeLabel;
}
- (UILabel *)otherLabel{
    if (!_otherLabel) {
        UILabel *label = [[UILabel alloc]init];
        label.text = @"应交：36人 实交：35人";
        label.font = [UIFont systemFontOfSize:12];
        label.textColor = TITLECOLOR;
        _otherLabel = label;
    }
    return _otherLabel;
}

@end
